package com.eastfair.home.controller;

import com.eastfair.core.base.R;
import com.eastfair.core.exception.BizException;
import com.eastfair.home.service.HomeWorkOvertimeService;
import com.eastfair.venueservice.dto.WorkOvertimeDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 主场加班 Rest Api
 *
 * @author dqq
 * @date 2023 /5/16
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/homeWorkerOvertime")
public class HomeWorkOvertimeController {

    @Resource
    private HomeWorkOvertimeService homeWorkOvertimeService;

    /**
     * 发送配置收款商户的站内信
     *
     * @param workOvertimeDTO the work overtime dto
     * @return the r
     */
    @PostMapping("/send/config/payee/innerMsg")
    public R<Boolean> sendConfigPayeeInnerMsg(@RequestBody WorkOvertimeDTO workOvertimeDTO) {
        log.info("sendConfigPayeeInnerMsg - 发送配置收款商户的站内信, workOvertimeDTO={}", workOvertimeDTO);
        try {
            return R.successDef(homeWorkOvertimeService.sendConfigPayeeInnerMsg(workOvertimeDTO));
        } catch (BizException e) {
            return R.fail(e);
        }
    }
}